package com.fenghongzhang.module_home

import com.fenghongzhang.lib_base.core.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class HomeViewModel  @Inject constructor(val repository: HomeRepository) : BaseViewModel<HomeUIState, HomeIntent>(
    HomeUIState()
) {
    override suspend fun handleEvent(event: HomeIntent) {
       when (event) {
           is HomeIntent.GetRecommendMutilVideo -> TODO()
           is HomeIntent.GetSimpleType -> getTabLayoutData()
           is HomeIntent.SearchData -> TODO()
       }
    }

    private suspend fun getTabLayoutData() {
       val res =  repository.getTabLayoutData()
        res.onSuccess {
            updateState(HomeUIState(simpleType = it.simpleType,  isSucess = true))
        }.onFailure {

        }
    }


}